﻿using MediatR;
using T_Rbac.Read.APi.Application.Command.Dapartments;
using T_Rbac_Demain;
using T_Rbac_Rep.Interface;

namespace T_Rbac.Read.APi.Application.Handlers.DapartmentHandlers
{
    public class DapartmentReadAllHandlers : IRequestHandler<DapartmentsReadAllCommand, IQueryable<Dapartment>>
    {
        private readonly IDapartment dapartment;

        public DapartmentReadAllHandlers(IDapartment dapartment)
        {
            this.dapartment = dapartment;
        }

        public async Task<IQueryable<Dapartment>> Handle(DapartmentsReadAllCommand request, CancellationToken cancellationToken)
        {
            var list = await dapartment.GetvaluesByResult(x => x.IsDel.Equals(false));
            return list;
        }
    }
}
